<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("components4phpfull/jtdivwindow.inc.php");
use_unit("components4phpfull/jtgroupbox.inc.php");
use_unit("platinumgrid/jtplatinumgrid.inc.php");
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class route_emp_list extends Page
{
       public $JTDivInfo = null;
       public $JTGroupBox5 = null;
       public $Label13 = null;
       public $imgInfo = null;
       public $Image1 = null;
       public $img_personnel = null;
       public $img_vehicle = null;
       public $edSearch = null;
       public $btnSearch = null;
       public $Image4 = null;
       public $JTEmployee = null;
       public $JTSiteTheme1 = null;



       function img_vehicleJSClick($sender, $params)
       {

       ?>
       window.location.href = 'route_log_list2.php';

       <?php

       }

       function img_vehicleJSMouseOver($sender, $params)
       {

       ?>
       document.getElementById('img_vehicle').src = 'image/vehicle_list2.png';

       <?php

       }


       function img_vehicleJSMouseOut($sender, $params)
       {

       ?>
       document.getElementById('img_vehicle').src = 'image/vehicle_list1.png';

       <?php

       }

       function imgInfoJSClick($sender, $params)
       {

       ?>
       document.getElementById('JTDivInfo').Show();

       <?php

       }


       function edSearchJSClick($sender, $params)
       {

       ?>
       document.getElementById('edSearch').value = '';
       <?php

       }

       function JTEmployeeShow($sender, $params)
       {
       $query1 = "select * from employee_tbl where
       (
       emp_id like '%".$this->edSearch->Text."%' OR
       lname like '%".$this->edSearch->Text."%' OR
       fname like '%".$this->edSearch->Text."%' OR
       job_title like '%".$this->edSearch->Text."%' OR
       phone_num like '%".$this->edSearch->Text."%' OR
       department like '%".$this->edSearch->Text."%'
       ) AND
       company_id='".$_SESSION['company_id']."' order by terminate ASC,job_title ASC";
       $result = mysql_query($query1)or die(mysql_error());

        $arr = array();
        while($row = mysql_fetch_array($result))
          {

            $emp = $row['autoid'];
            $title = $row['job_title'];
            $terminated = $row['terminate'];
            $veh_op = $row['veh_op'];

            if($terminated==1)
            {
            $color = "Silver";
            }

            if($terminated==0)
            {
            $color = "Black";
            }

            $photo = "<div align='center'><img src='".$row['photo']."' height='50px' width='50px'/></div>";
            $tool_fuel = "<a href=route_emp_fuel_list.php?emp=".$emp."><img src='image/rfuel.png' title='fuel' no border></a>";
            $arr[] = array(
                        'Photo' => "<p style='color:".$color."'>".$photo."</p>",
                        'Emp ID' => "<p style='color:".$color."'>".$row['emp_id']."</p>",
                        'Name' => "<p style='color:".$color."'>".$row['lname'].','.$row['fname']."</p>",
                        'Job Title' => "<p style='color:".$color."'>".$row['job_title']."</p>",
                        'Contact Num' => "<p style='color:".$color."'>".$row['phone_num']."</p>",
                        'Department' => "<p style='color:".$color."'>".$row['department']."</p>",
                        'Tools' => $tool_fuel
                        );


          }

            $this->JTEmployee->setCellData($arr);


       }

}

global $application;

global $route_emp_list;

//Creates the form
$route_emp_list=new route_emp_list($application);

//Read from resource file
$route_emp_list->loadResource(__FILE__);

//Shows the form
$route_emp_list->show();

?>